package com.kevin.validation.model;

import com.kevin.validation.group.Add;
import com.kevin.validation.group.Cus;
import com.kevin.validation.group.Edit;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import java.io.Serial;
import java.io.Serializable;

@Getter
@Setter
@ToString
@Accessors(chain = true)
public class UserDTO implements Serializable {

    @Serial
    private static final long serialVersionUID = 6653471938944866982L;

    @NotNull(groups = {Edit.class, Cus.class}, message = "用户ID不能为空")
    private Integer id;

    @Length(groups = {Add.class, Edit.class}, min = 6, max = 20, message = "用户名称有效字符长度范围6-20个字符")
    @NotEmpty(groups = {Add.class, Edit.class}, message = "用户名称不能为空")
    private String name;

    @Length(groups = {Add.class, Cus.class}, min = 6, max = 20, message = "密码有效字符长度范围6-12个字符")
    @NotEmpty(groups = {Add.class, Cus.class}, message = "密码不能为空")
    private String password;

}
